/*
 * @Author: _LJP 2634716776@qq.com
 * @Date: 2023-12-18 08:42:49
 * @LastEditors: _LJP 2634716776@qq.com
 * @LastEditTime: 2023-12-18 20:16:09
 * @FilePath: /my_-linux/Pro23/BinarySearchT1130/ReveiwBST/test.cpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <iostream>

#include"BinarySearchT.hpp"

using namespace std;

void test1()
{
    BinarySearchTree<int> t1;
    int arr[] = {8,3,1,10,6,4,7,14,13};
    for(auto it:arr)
    {
        t1.Insert(it);
    }
    t1.InOrder();
    cout<<endl;

    cout << t1.Find(10) << endl;
    cout << t1.Find(2) << endl;
}

void test2()
{
    BinarySearchTree<int> t1;
    int arr[] = {8, 3, 1, 10, 6, 4, 7, 14, 13};
    // int arr[] = {8, 3, 1,  6, 4, 7};

    for (auto it : arr)
    {
        // t1.Insert(it);
        t1.InsertR(it);
    }
    t1.InOrder();

    //t1.Erase(8);
    t1.EraseR(8);
    t1.InOrder();

    //t1.Erase(14);
    t1.EraseR(14);
    t1.InOrder();

    //t1.Erase(3);
    t1.EraseR(3);
    t1.InOrder();

    //t1.Erase(7);
    t1.EraseR(7);
    t1.InOrder();

    //t1.Erase(4);
    t1.EraseR(4);
    t1.InOrder();

    //t1.Erase(1);
    t1.EraseR(1);
    t1.InOrder();

    BinarySearchTree<int> t2(t1);
    t2.InOrder();

    t2.EraseR(13);
    t1 = t2;
    t1.InOrder();
}

int main()
{
    // test1();
    test2();
}